/*******************************************************************************
 * Package: com.hngtrust.iir.company.controller.vo
 * Type:    DuPontAnalysisController
 * Date:    2021/4/22 19:29
 *
 * Copyright (c) 2021 HUANENG GUICHENG TRUST CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.hngtrust.iir.company.controller;

import com.hngtrust.framework.bind.ResponseInfo;
import com.hngtrust.framework.page.service.PageService;
import com.hngtrust.iir.base.service.SpeechcraftService;
import com.hngtrust.iir.company.controller.vo.CompFinanceTrendReqVO;
import com.hngtrust.iir.company.controller.vo.ListCompDpAnalysRespVO;
import com.hngtrust.iir.company.controller.vo.ListCompDpAnalysTrendRespVO;
import com.hngtrust.iir.company.controller.vo.ListFiancialReqVo;
import com.hngtrust.iir.company.service.CompDpAnalysService;
import com.hngtrust.iir.company.service.CompDpEvaluateService;
import com.hngtrust.iir.company.service.DuPontAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 杜邦分析信息
 *
 * @author Wanghan
 * @date 2021/4/22 19:29
 */

@Slf4j
@Api(tags = "杜邦分析信息")
@RestController
@RequestMapping("/company")
public class DuPontAnalysisController {
    
    @Autowired
    private CompDpAnalysService compDpAnalysService;
    
    @Autowired
    private CompDpEvaluateService compDpEvaluateService;
    
    @Autowired
    private SpeechcraftService speechcraftService;
    
    @Autowired
    private DuPontAnalysisService duPontAnalysisService;
    
    /**
     * 分页服务
     */
    @Autowired
    private PageService pageService;
    
    /**
     * 杜邦分析
     */
    @ApiOperation(value = "杜邦分析", notes = "杜邦分析")
    @PostMapping("/list-dp-analys")
    public ResponseInfo<List<ListCompDpAnalysRespVO>> listDpAnalys(
            @ApiParam(value = "杜邦分析") @Valid @RequestBody ListFiancialReqVo req){
        log.info("FinanceController.listDpAnalys start...");
        
        List<ListCompDpAnalysRespVO> listCompDpAnalysRespVO = duPontAnalysisService.getCompDpAnalysRespVO(req);
        ResponseInfo<List<ListCompDpAnalysRespVO>> data = new ResponseInfo<>();
        
        data.setData(listCompDpAnalysRespVO);
        return data;
    }
    
    /**
     * 杜邦分析走势图
     */
    @ApiOperation(value = "杜邦分析走势图", notes = "杜邦分析走势图")
    @PostMapping("/list-dp-analys-trend")
    public ResponseInfo<List<ListCompDpAnalysTrendRespVO>> listDpAnalysTrend(
            @ApiParam(value = "杜邦分析走势图") @Valid @RequestBody CompFinanceTrendReqVO req){
        log.info("FinanceController.listDpAnalysTrend start...");
    
        List<ListCompDpAnalysTrendRespVO> listCompDpAnalysTrendRespVO = duPontAnalysisService.getCompDpAnalysTrendRespVO(req);
        
        ResponseInfo<List<ListCompDpAnalysTrendRespVO>> data = new ResponseInfo<>();
        data.setData(listCompDpAnalysTrendRespVO);
        return data;
    }
}
